/**
 *	(C) 2014 Yuanjj
 *
 *	define tunnel objects manager class
 *
 *	histroy
 * 		2014-08-07	yuanjj	- create the file
 */

#ifndef _TUNNEL_H_
#define _TUNNEL_H_

#include "typedef.h"
#include "routine/tools/queue/queue.h"

/**
 *	tunnel index define
 */
enum
{
    CL_DB,			// data base tunnel index
    CL_NET,			// net work tunnel index
    CL_UI,			// ui tunnel index
    CL_ALL			// tunnel count
};

/**
 *	tunnels manager object
 */
class cls_tunnel
{
public:
   cls_tunnel();
   ~cls_tunnel();

protected:
   cls_queue		*m_que_array[CL_ALL];		// tunnel pointer array
   cls_queue		m_que_db;					// data base tunnel
   cls_queue		m_que_net;					// net work tunnel
   cls_queue		m_que_ui;					// ui tunnel

public:
   /**
    *	initialize the tunnel object
    */
   pem_error_t	instance();

   /**
    *	releas the tunnel object
    */
   pem_void_t	release();

   /**
    *	put data into the special tunnel
    */
   pem_error_t	putdata( pem_u8_t type, pem_s8_t* pdata, pem_u32_t size, pem_s32_t flag = IN_AFTER );

   /**
    *	get data from the speical tunnel
    */
   pem_error_t	getdata( pem_u8_t type, pem_s8_t* pdata, pem_u32_t size );

   /**
    *	clear up special tunnel
    */
   pem_error_t	setempty( pem_u8_t type );
};

#endif // _TUNNEL_H_
